package com.voda.service.api;

import com.voda.entity.Role;
import com.voda.entity.User;

/**
 * The Interface IUserService.
 */
/**
 * @author dzmitry_dubrovin
 *
 */
public interface IUserService extends IGenericService<User> {

	/**
	 * Find user.
	 *
	 * @param login the login
	 * @param password the password
	 * @return the user
	 */
	User findUser(String login, String password);
	
	/**
	 * Gets the user with role.
	 *
	 * @param id the id
	 * @return the user with role
	 */
	public User getUserWithRole(Long id);

	/**
	 * Creates the user.
	 *
	 * @param email creates an user with role 'admin' for @param company
	 * @return the user
	 */
	public User createUser(String email);
	
	/**
	 * Creates the user.
	 *
	 * @param email the email
	 * @param roleName the role name
	 * @return the user
	 */
	public User createUser( String email, String roleName);
	
	/**
	 * Update user blocking.
	 *
	 * @param id the id
	 * @param blocked the blocked
	 */
	public void updateUserBlocking(Long id, Boolean blocked);
	
	/**
	 * Reset password by admin.
	 *
	 * @param user the user
	 */
	public void resetPasswordByAdmin(User user);

	/**
	 * Reset password by user.
	 *
	 * @param userId the user id
	 * @param oldPassword the old password
	 * @param newPassword the new password
	 */
	public void resetPasswordByUser(Long userId, String oldPassword, String newPassword);
	
	/**
	 * Check unique.
	 *
	 * @param name the name
	 * @return true, if successful
	 */
	public boolean checkUnique(String name);
	
	/**
	 * Update user.
	 *
	 * @param userId the user id
	 * @param email the email
	 * @param name the name
	 * @param role the role
	 */
	public void updateUser(Long userId, String email, String name, Role role);
	
	/**
	 * Gets the user by email.
	 *
	 * @param email the email
	 * @return the user by email
	 */
	public User getUserByEmail(String email);
	
}
